<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数据预测</title>
    <style>
        .container {
            width: 50%;
            margin: 50px auto;
        }
        .input-group, .output-group {
            margin-bottom: 20px;
        }
        .input-group input {
            width: 100%;
            padding: 10px;
            font-size: 16px;
        }
        .output-group input {
            width: 100%;
            padding: 10px;
            font-size: 16px;
            background-color: #f4f4f4;
            border: none;
            pointer-events: none;
        }
        .btn {
            padding: 10px 20px;
            font-size: 16px;
            background-color: #007bff;
            color: #fff;
            border: none;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="input-group">
            <input type="text" id="uid" placeholder="请输入uid">
        </div>
        <div class="input-group">
            <input type="text" id="time" placeholder="请输入time">
        </div>
        <div class="input-group">
            <input type="text" id="content" placeholder="请输入content">
        </div>
        <button class="btn" onclick="predict()">预测</button>
        <div class="output-group">
            <input type="text" id="forward_count" placeholder="forward_count" readonly>
        </div>
        <div class="output-group">
            <input type="text" id="comment_count" placeholder="comment_count" readonly>
        </div>
        <div class="output-group">
            <input type="text" id="like_count" placeholder="like_count" readonly>
        </div>
    </div>

    <script>
        function predict() {
            var uid = document.getElementById("uid").value;
            var time = document.getElementById("time").value;
            var content = document.getElementById("content").value;

            fetch('/predict', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                },
                body: JSON.stringify({
                    uid: uid,
                    time: time,
                    content: content
                })
            })
            .then(response => response.json())
            .then(data => {
                document.getElementById("forward_count").value = data.forward_count;
                document.getElementById("comment_count").value = data.comment_count;
                document.getElementById("like_count").value = data.like_count;
            })
            .catch(error => console.error('Error:', error));
        }
    </script>
</body>
</html>
